﻿@{
    ViewBag.Title = "CarManagement";
    Layout = "~/Views/Shared/_BootstrapUI.cshtml";
}
<link href="~/Content/dataTable/dtConfig.css" rel="stylesheet" />
<link href="~/Content/datetimePicker/datetimePicker.css" rel="stylesheet" />
<script src="~/Content/datetimePicker/moment.js"></script>
<script src="~/Content/fileInput/js/fileinput.min.js"></script>
<script src="~/Content/fileInput/js/zh.js"></script>
<link href="~/Content/fileInput/css/fileinput.min.css" rel="stylesheet" />

<div class="panel panel-default mb0">
    <div class="panel-body bb panel_inquire">
        <form id="form_inquire" role="form" class="form-inline">
            <div class="form-group">
                <div id="datetimepicker_st" class="input-group date">
                    <input id="date_st" type="text" class="form-control" placeholder="录入新增开始日期" style="width: 150px;">
                    <span class="input-group-addon">
                        <span class="fa fa-calendar"></span>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div id="datetimepicker_ed" class="input-group date">
                    <input id="date_ed" type="text" class="form-control" placeholder="录入新增结束日期" style="width: 150px;">
                    <span class="input-group-addon">
                        <span class="fa fa-calendar"></span>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <input id="query" type="text" class="form-control" placeholder="关键字" style="width: 110px;">
            </div>
            <button id="btnInquire" type="button" class="btn btn-primary">查&nbsp;询</button>
        </form>
    </div>
    <input type="hidden" id="btn_val" />
    <div id="btnOp" class="panel-heading">
    </div>
    <div class="panel-body bt panel-body-dt-normal">
        <div class="table-responsive">
            <table id="dt_admin" class="table table-striped nowrap"></table>
        </div>
    </div>
</div>

<div id="InsuranceAccountAddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabelLarge" aria-hidden="true" class="modal fade">
    <div class="modal-dialog" style="width: 80%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" data-dismiss="modal" aria-label="Close" class="close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 id="title" class="modal-title">车辆信息录入</h4>
            </div>
            <div class="modal-body">
                <form id="form" role="form" class="form-horizontal" data-parsley-validate="" novalidate="">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">营动车统一编码</label>
                                <div class="col-md-8">
                                    <input id="id" type="hidden" value="-1" />
                                    <input id="vehiclecode" type="text" placeholder="营动车统一编码" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入营动车统一编码..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">车主（或驾驶员）</label>
                                <div class="col-md-8">
                                    <input id="carowner" type="text" placeholder="车主（或驾驶员）" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请车主（或驾驶员）..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">车型</label>
                                <div class="col-md-8">
                                    <select id="carmodel" type="text"  placeholder="车型" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入车型...">
                                        @{
                                            var list = new FZKJ.BLL.sys_dict().GetModelList(" value='carmodel'");
                                            if (list.Count > 0)
                                            {
                                                var childrens = new FZKJ.BLL.sys_dict().GetModelList(" pid=" + list[0].id);
                                                foreach (var item in childrens)
                                                {
                                                    <option value="@item.value">@item.value</option>
                                                }
                                            }
                                        }
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">车牌</label>
                                <div class="col-md-8">
                                    <input id="licenseplate" type="text" placeholder="车牌" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入车牌..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">车驾号</label>
                                <div class="col-md-8">
                                    <input id="drivingnumber" type="text" placeholder="车驾号" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入车驾号..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">发动机号</label>
                                <div class="col-md-8">
                                    <input id="enginenumber" type="text"  placeholder="发动机号" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入发动机号..." />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">座位数</label>
                                <div class="col-md-8">
                                    <input id="pedestal" type="text" placeholder="座位数" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入座位数..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">手机号</label>
                                <div class="col-md-8">
                                    <input id="mobile" type="text" placeholder="手机号" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入手机号..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">运输公司</label>
                                <div class="col-md-8">
                                    <input id="transportcompany" type="text" placeholder="运输公司" class="form-control  input-sm  input-sm" required="required" data-parsley-error-message="请输入运输公司..." />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">核定载重量</label>
                                <div class="col-md-8">
                                    <input id="nuclearweight" type="text" placeholder="核定载重量" class="form-control  input-sm input-sm" required="required" data-parsley-error-message="请输入核定载重量..." />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-4 control-label">初登日期</label>
                                <div class="col-md-8">
                                    <div class="form-group" style="margin-left: 0px; margin-right: 0px;">
                                        <div id="datetimepicker_start" class="input-group date">
                                            <input id="initialdate" type="text" class="form-control  input-sm" placeholder="初登日期">
                                            <span class="input-group-addon">
                                                <span class="fa fa-calendar"></span>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
                <button id="btnSpecialPolicySave" type="button" class="btn btn-primary">保存</button>
            </div>
        </div>
    </div>
</div>



<div id="ImportModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabelLarge" aria-hidden="true" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" data-dismiss="modal" aria-label="Close" class="close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 id="titleimport" class="modal-title">导入营运车辆信息</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="row" style="padding:12px">
                        <label class="col-md-4 control-label">导入文件</label>
                        <div class="col-md-8">
                            <div class="modal-body">
                                <input type="file" name="txt_file" id="txt_file" multiple class="file-loading" />
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>



<script src="~/Content/datetimePicker/moment.js"></script>
<script src="~/Content/datetimePicker/datetimePicker.js"></script>
<script src="~/Pscripts/BaseInfo/CarManagement.js?v=@DateTime.Now.ToString("yyyyMMddHHmmssfff")"></script>
<script>
    $(function () {
        //0.初始化fileinput
        var oFileInput = new FileInput();
        oFileInput.Init("txt_file", "/BaseInfo/ImportCar");
    });
    //初始化fileinput
    var FileInput = function () {
        var oFile = new Object();

        //初始化fileinput控件（第一次初始化）
        oFile.Init = function (ctrlName, uploadUrl) {
            var control = $('#' + ctrlName);
            //初始化上传控件的样式
            control.fileinput({
                language: 'zh', //设置语言
                uploadUrl: uploadUrl, //上传的地址
                allowedFileExtensions: ['xlsx', 'xls'],//接收的文件后缀
                showUpload: true, //是否显示上传按钮
                showCaption: false,//是否显示标题
                browseClass: "btn btn-primary",
                maxFileCount: 10, //表示允许同时上传的最大文件个数
                enctype: 'multipart/form-data',
                validateInitialCount: true,
                previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
                uploadExtraData: function () {//向后台传递参数
                    var data = {
                        time: $('#date_im').val(),
                        method: $('#immethod').val()
                    };
                    return data;
                }
            });

            //导入文件上传完成之后的事件
            $("#txt_file").on("fileuploaded", function (event, data, previewId, index) {
                var data = data.response;
                if (data.IsSucceed) {
                    $("#ImportModal").modal("hide");
                    $.notify({
                        message: '<i class="fa ' + (data.IsSucceed ? 'fa-check' : 'fa-exclamation') + '"></i> ' + data.Message,
                        status: data.IsSucceed ? 'success' : "danger",
                        pos: "bottom-right"
                    });
                    loadTableData();
                } else if (!data.IsSucceed) {
                    $.notify({
                        message: '<i class="fa ' + (data.IsSucceed ? 'fa-check' : 'fa-exclamation') + '"></i> ' + data.Message,
                        status: data.IsSucceed ? 'success' : "danger",
                        pos: "bottom-right"
                    });
                    loadTableData();
                }
                else {
                    if (data.Entity != "" && data.Entity != null)
                        window.parent.location.href = data.Entity;
                }
            });
        }
        return oFile;
    };
</script>
